/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Wires.impl;

import EA_Model.IEC61970.Core.impl.ConductingEquipmentImpl;

import EA_Model.IEC61970.Domain.AbsoluteDateTime;

import EA_Model.IEC61970.Wires.Switch;
import EA_Model.IEC61970.Wires.WiresPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Switch</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.SwitchImpl#getNormalOpen <em>Normal Open</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.SwitchImpl#getRetained <em>Retained</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.SwitchImpl#getSwitchOnCount <em>Switch On Count</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.SwitchImpl#getSwitchOnDate <em>Switch On Date</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SwitchImpl extends ConductingEquipmentImpl implements Switch {
	/**
	 * The cached value of the '{@link #getNormalOpen() <em>Normal Open</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNormalOpen()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Boolean normalOpen;

	/**
	 * The cached value of the '{@link #getRetained() <em>Retained</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRetained()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Boolean retained;

	/**
	 * The cached value of the '{@link #getSwitchOnCount() <em>Switch On Count</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSwitchOnCount()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Integer switchOnCount;

	/**
	 * The cached value of the '{@link #getSwitchOnDate() <em>Switch On Date</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSwitchOnDate()
	 * @generated
	 * @ordered
	 */
	protected AbsoluteDateTime switchOnDate;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SwitchImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return WiresPackage.Literals.SWITCH;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean getNormalOpen() {
		if (normalOpen != null && normalOpen.eIsProxy()) {
			InternalEObject oldNormalOpen = (InternalEObject)normalOpen;
			normalOpen = (EA_Model.IEC61970.Domain.Boolean)eResolveProxy(oldNormalOpen);
			if (normalOpen != oldNormalOpen) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.SWITCH__NORMAL_OPEN, oldNormalOpen, normalOpen));
			}
		}
		return normalOpen;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean basicGetNormalOpen() {
		return normalOpen;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNormalOpen(EA_Model.IEC61970.Domain.Boolean newNormalOpen) {
		EA_Model.IEC61970.Domain.Boolean oldNormalOpen = normalOpen;
		normalOpen = newNormalOpen;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.SWITCH__NORMAL_OPEN, oldNormalOpen, normalOpen));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean getRetained() {
		if (retained != null && retained.eIsProxy()) {
			InternalEObject oldRetained = (InternalEObject)retained;
			retained = (EA_Model.IEC61970.Domain.Boolean)eResolveProxy(oldRetained);
			if (retained != oldRetained) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.SWITCH__RETAINED, oldRetained, retained));
			}
		}
		return retained;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean basicGetRetained() {
		return retained;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRetained(EA_Model.IEC61970.Domain.Boolean newRetained) {
		EA_Model.IEC61970.Domain.Boolean oldRetained = retained;
		retained = newRetained;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.SWITCH__RETAINED, oldRetained, retained));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Integer getSwitchOnCount() {
		if (switchOnCount != null && switchOnCount.eIsProxy()) {
			InternalEObject oldSwitchOnCount = (InternalEObject)switchOnCount;
			switchOnCount = (EA_Model.IEC61970.Domain.Integer)eResolveProxy(oldSwitchOnCount);
			if (switchOnCount != oldSwitchOnCount) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.SWITCH__SWITCH_ON_COUNT, oldSwitchOnCount, switchOnCount));
			}
		}
		return switchOnCount;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Integer basicGetSwitchOnCount() {
		return switchOnCount;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSwitchOnCount(EA_Model.IEC61970.Domain.Integer newSwitchOnCount) {
		EA_Model.IEC61970.Domain.Integer oldSwitchOnCount = switchOnCount;
		switchOnCount = newSwitchOnCount;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.SWITCH__SWITCH_ON_COUNT, oldSwitchOnCount, switchOnCount));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteDateTime getSwitchOnDate() {
		if (switchOnDate != null && switchOnDate.eIsProxy()) {
			InternalEObject oldSwitchOnDate = (InternalEObject)switchOnDate;
			switchOnDate = (AbsoluteDateTime)eResolveProxy(oldSwitchOnDate);
			if (switchOnDate != oldSwitchOnDate) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.SWITCH__SWITCH_ON_DATE, oldSwitchOnDate, switchOnDate));
			}
		}
		return switchOnDate;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteDateTime basicGetSwitchOnDate() {
		return switchOnDate;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSwitchOnDate(AbsoluteDateTime newSwitchOnDate) {
		AbsoluteDateTime oldSwitchOnDate = switchOnDate;
		switchOnDate = newSwitchOnDate;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.SWITCH__SWITCH_ON_DATE, oldSwitchOnDate, switchOnDate));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case WiresPackage.SWITCH__NORMAL_OPEN:
				if (resolve) return getNormalOpen();
				return basicGetNormalOpen();
			case WiresPackage.SWITCH__RETAINED:
				if (resolve) return getRetained();
				return basicGetRetained();
			case WiresPackage.SWITCH__SWITCH_ON_COUNT:
				if (resolve) return getSwitchOnCount();
				return basicGetSwitchOnCount();
			case WiresPackage.SWITCH__SWITCH_ON_DATE:
				if (resolve) return getSwitchOnDate();
				return basicGetSwitchOnDate();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case WiresPackage.SWITCH__NORMAL_OPEN:
				setNormalOpen((EA_Model.IEC61970.Domain.Boolean)newValue);
				return;
			case WiresPackage.SWITCH__RETAINED:
				setRetained((EA_Model.IEC61970.Domain.Boolean)newValue);
				return;
			case WiresPackage.SWITCH__SWITCH_ON_COUNT:
				setSwitchOnCount((EA_Model.IEC61970.Domain.Integer)newValue);
				return;
			case WiresPackage.SWITCH__SWITCH_ON_DATE:
				setSwitchOnDate((AbsoluteDateTime)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case WiresPackage.SWITCH__NORMAL_OPEN:
				setNormalOpen((EA_Model.IEC61970.Domain.Boolean)null);
				return;
			case WiresPackage.SWITCH__RETAINED:
				setRetained((EA_Model.IEC61970.Domain.Boolean)null);
				return;
			case WiresPackage.SWITCH__SWITCH_ON_COUNT:
				setSwitchOnCount((EA_Model.IEC61970.Domain.Integer)null);
				return;
			case WiresPackage.SWITCH__SWITCH_ON_DATE:
				setSwitchOnDate((AbsoluteDateTime)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case WiresPackage.SWITCH__NORMAL_OPEN:
				return normalOpen != null;
			case WiresPackage.SWITCH__RETAINED:
				return retained != null;
			case WiresPackage.SWITCH__SWITCH_ON_COUNT:
				return switchOnCount != null;
			case WiresPackage.SWITCH__SWITCH_ON_DATE:
				return switchOnDate != null;
		}
		return super.eIsSet(featureID);
	}

} //SwitchImpl
